<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="classes/conndb.jsp"%>

<%!
   public String getAlertMessage(String txt,String goUrl){
	    String msg = "alert('"+txt+"');";
		return "<script>"+msg+"window.location.href = '"+goUrl+"';</script>";
	}
%>

<%
	PreparedStatement ps = null;
	Connection con = null;
	ResultSet rs = null;
	
    
	String message_id = request.getParameter("message_id") == null ? "" : request.getParameter("message_id");
	
	int count = 0;
	String sql = "";
		sql = "delete from cms_public_comment where message_id =?";
		try {
			con = getConnection();
			ps = con.prepareStatement(sql);
			ps.setObject(1, message_id);
			count = ps.executeUpdate();

		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			closeConn(con, ps, rs);
		}

	if (count > 0) {
		out.print(getAlertMessage("删除成功","list.jsp?t="+new java.util.Date().getTime()));
	} else {
		out.print(getAlertMessage("删除失败","list.jsp?t="+new java.util.Date().getTime()));
	}
%>